Skip to content

P21: REPL doesn't echo None (as CPython); no «Visualisieren» for help/dir - #37

Merged
cedricvogel-leo merged 1 commit into
mainfrom
fix/repl-no-none-echo
Oct 26, 2026
Merged

cedricvogel-leo merged 1 commit into
mainfrom
fix/repl-no-none-echo

Conversation

@cedricvogel-leo

Copy link
Copy Markdown
Collaborator

Fidelity fix P21, needed before Etappe 3.

1. No echo for None

CPython's interactive REPL never displays a result that is None (sys.displayhook skips it). help(f), a call of a function without return and print(…) show only what they print. glpython added a greyed-out None line, e.g. after >>> help(zeugnis_note).

  • _glpython_repl now reports no value for None, like a statement. This applies to the embed and the IDE alike; the greyed None style is gone.
  • The visualizer's trace of a REPL input also reports no value for None. Otherwise the replay check (2c) would compare a value against no value. Visualizing melde('hallo') still works (checked in the embed).
  • The README REPL section is updated. It used to describe None as shown on purpose.

2. No «Visualisieren» for help(…) / dir(…)

A single call of the builtin help or dir only prints documentation or names, so there's nothing to step through. Its entry gets no button (untraced). A function of the learner's that is called help keeps its button. print(1 + 2) keeps its button too, since 1 + 2 can be stepped through.

Test against CPython

scripts/check-runtime-repl.py (in test:runtime) runs python3 -i on the same file and compares, input by input, what it writes to stdout with what glpython's REPL shows. The inputs: help(zeugnis_note), melde('hallo') (no return), print(1), None, zeugnis_note(18, 24), an assignment, x, [None, melde(…)] and print. It also checks the help/dir flag, including the learner's own help. Against main it fails in 6 places: the extra None after help, melde, print and None, and the missing flag.

Checked in the built embed (Pyodide): help(zeugnis_note) shows only its documentation and has no «Visualisieren»; melde('hallo'), print(1) and None show no None line; zeugnis_note(18, 24) → 4.8.

Lint (known warning only), both builds, test:protocol and test:runtime (10 scripts) pass. After the merge I tag v0.1.16 and bump the IDE.

🤖 Generated with Claude Code

CPython's interactive REPL never displays a None result (sys.displayhook
skips it): help(f), a call of a function without return and print(...)
show only what they print. glpython showed a trailing greyed-out None.
_glpython_repl now reports no value for None (the visualizer's trace of a
REPL input likewise, so the replay check still compares like with like).

A call of the builtin help or dir only prints documentation or names, so
its entry has no «Visualisieren» ("untraced"); a function of the
learner's called help still has one.

check-runtime-repl.py compares the REPL with `python3 -i` on the same file,
input by input: help(f), a function without return, print(1), None, a
value, an assignment, a list containing None.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cedricvogel-leo
cedricvogel-leo merged commit c352b1a into main Oct 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant